<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test</title>
</head>
<body>
<table id="test123">
  <tr>
    <td class="test">我是1</td>
    <td id="id1">1</td>
  </tr>
  <tr>
    <td class="test">我是2</td>
    <td id="id2">2</td>
  </tr>
  <tr>
    <td class="test"> 我是3</td>
    <td id="id3">3</td>
  </tr>
  <tr>
    <td class="test">我是4</td>
    <td id="id4">4</td>
  </tr>
</table>

<script src="static/assets/global/plugins/jquery-1.11.0.min.js" type="text/javascript"></script>
<script>
  console.log("hello world")
  $(".test").click(function () {
    var id = $(this).siblings("td").html();  //获取兄弟td元素中的值
    sessionStorage.setItem("id",id);          //将数据存入sessionStorage

    // location.href = "detial.html";            //页面跳转
  });
  console.log(sessionStorage.getItem("id"));

</script>
</body>
</html>




